package at.fhooe.mcm.lri.mdmpoc.warehouse.datamodel;


import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Text;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Person {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long key;

	// with the Extension, can we avoid that the name property is indexed
	@Persistent
	@Extension(vendorName="datanucleus", key="gae.unindexed", value="true")
	private String name;
	
	// Text will not be indexed
	// see https://developers.google.com/appengine/docs/java/datastore/entities
	@Persistent
	private Text biography;

	public Person() {
	}

	public Long getKey() {
		return key;
	}

	public void setKey(Long key) {
		this.key = key;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getBiography() {
		return (biography == null ? "" : biography.getValue());
	}

	public void setBiography(String biography) {
		this.biography = (biography == null ? null : new Text(biography));
	}

}

